package com.kzw.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.kzw.entity.User;
import com.kzw.mapper.UserMapper;

@Service
@Transactional
public class UserService {

	@Autowired
	private UserMapper mapper;

	public void save(User user) {
		mapper.save(user.getName(), user.getAge());
	}

	@Transactional(readOnly = true)
	public List<User> findAll() {
		return mapper.findAll();
	}

	@Transactional(readOnly = true)
	public List<User> findByName(String name, int age) {
		return mapper.findByName(name, age);
	}
}
